/*
 * =====================================================================================
 *
 *       Filename:  fork.c
 *
 *    Description:  fork demo
 *
 *        Version:  1.0
 *        Created:  04/27/2012 12:16:01 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Zhiyi Wu (Z.W), zhiyiw@uoregon.edu
 *        Company:  University of Oregon
 *
 * =====================================================================================
 */


#include	<stdlib.h>
#include	<stdio.h>
int main() {
	int num = 1;
	int child;

	if(!(child = fork())) { 
		printf("This is son, his num is: %d. and his pid is: %d\n", ++num, getpid());
		exit(0);
	} else {
		printf("This is father, his num is: %d, his pid is: %d\n",num, getpid());
	}
}
